from enum import Enum,auto

class HTTPMethod(Enum):
    GET = auto()
    POST = auto()
    PUT = auto()
    DELETE = auto()

    @classmethod
    def from_string(cls, method_str: str):
        try:
            return cls[method_str.upper()]
        except KeyError:
            raise ValueError(f"Invalid HTTP method: {method_str}")